﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <title>班级下拉框填充</title>

    <script src="../JS/jquery-1.8.3.min.js"></script>
    <script type="text/javascript">
        $(function () {
            $(".btnClear").click(function () {
                if (confirm("确认删除吗？")) {
                    var idValue = $(this).parent().attr("id");
                    $("#" + idValue).remove();
                }
              
                
            })
     
            $("#class1").empty();
            $.post("/Handlers/QueryClassHandler.ashx", "", function (data, status) {
                for (var i = 0; i < data.length; i++) {
                    var opt = "<option value="+data[i].ClassId+">" + data[i].ClassName + "</option>";
                    $("#class1").append(opt);
                }
            })
        })
    </script>
</head>
<body>
    <span>班级</span>
    <select id="class1"></select>
    <ul>
        <li id="1">计算机一班<input type="button" name="name" value="点击删除" class="btnClear"/>   </li>
        <li id="2">计算机二班 <input type="button" name="name" value="点击删除" class="btnClear" /> </li>
        <li id="3">计算机三班<input type="button" name="name" value="点击删除" class="btnClear" /> </li>
    </ul>
</body>
</html>